<!DOCTYPE html >
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
	<meta name="renderer" content="webkit"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<!--[if lt IE 9]>
		<script src="//cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
	<![endif]-->
	<title><!--{if !empty($navtitle)}-->$navtitle<!--{/if}--><!--{if empty($nobbname)}--> - $_G['setting']['bbname']<!--{/if}--></title>
	$_G['setting']['seohead']
	<meta name="keywords" content="{if !empty($metakeywords)}{echo dhtmlspecialchars($metakeywords)}{/if}" />
	<meta name="description" content="{if !empty($metadescription)}{echo dhtmlspecialchars($metadescription)} {/if}{if empty($nobbname)},$_G['setting']['bbname']{/if}" />
	<meta name="copyright" content="2001-2013 Comsenz Inc." />
	<base href="{$_G['siteurl']}" />
	<!--{csstemplate}-->
	<script type="text/javascript">var STYLEID = '{STYLEID}', STATICURL = '{STATICURL}', IMGDIR = '{IMGDIR}', VERHASH = '{VERHASH}', charset = '{CHARSET}', discuz_uid = '$_G[uid]', cookiepre = '{$_G[config][cookie][cookiepre]}', cookiedomain = '{$_G[config][cookie][cookiedomain]}', cookiepath = '{$_G[config][cookie][cookiepath]}', showusercard = '{$_G[setting][showusercard]}', attackevasive = '{$_G[config][security][attackevasive]}', disallowfloat = '{$_G[setting][disallowfloat]}', creditnotice = '<!--{if $_G['setting']['creditnotice']}-->$_G['setting']['creditnames']<!--{/if}-->', defaultstyle = '$_G[style][defaultextstyle]', REPORTURL = '$_G[currenturl_encode]', SITEURL = '$_G[siteurl]', JSPATH = '$_G[setting][jspath]', CSSPATH = '$_G[setting][csspath]', DYNAMICURL = '$_G[dynamicurl]';</script>
	<script type="text/javascript" src="{$_G[setting][jspath]}common.js?{VERHASH}"></script>
	<link rel="stylesheet" type="text/css" href="./source/plugin/jameson_read/images/uk3/css/uikit.css">
	<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
	<script type="text/javascript">
		var xifeng = jQuery.noConflict(true);
		(window.jQuery && jQuery().jquery > '2.0') || (window.jQuery = xifeng);
	</script>
	<script type="text/javascript" src="./source/plugin/jameson_read/images/uk3/js/uikit.js"></script>
	<script type="text/javascript" src="./source/plugin/jameson_read/images/uk3/js/uikit-icons.js"></script>
	<script type="text/javascript" charset="utf-8" src="./source/plugin/jameson_read/images/wangEditor.min.js"></script>
	<script src="//cdn.bootcss.com/layer/2.4/layer.min.js"></script>
	<style type="text/css">
		body{background: none !important;}
		/*cebian*/
		.cebian{background-color: #3f3f3f;width: 16%;max-width: 200px;min-width: 150px;overflow: hidden;position: fixed;left: 0;top: 0;bottom: 0;}
		.uk-card img{max-width: 120px;}
		.uk-card, .uk-card a{color: #f5f5f5;}
		.uk-button.uk-button-border{background: transparent;color: #ec7259;border:1px solid #ec7259;}
		/*right*/
		.right{margin-left: 17%;position: relative;}
		.right.quanping{margin-left: 0;}
		.right > .uk-form{display: block;margin:15px auto;width: 95%;min-width: 960px;}
		#editwrap {position: relative;}
		.quanpingbtn{position: absolute;right: 10px;top: 3px;cursor: pointer;} 
		#savecaogao{position: absolute;right: 40px;top: 5px;}
		#caogaoxiang{position: absolute;right: 80px;top: 5px;}
		#jameson_read .uk-input-short{width: 150px;display: inline-block;}
		#jameson_read .uk-label-auto{display: inline-block;width: auto;height: 40px;line-height: 40px;margin:0 10px;}
		#jameson_read .uk-form-controls{margin-left: auto;}
		ul,ul li{list-style: inherit;}
		ol, ol li{list-style: decimal;}
		#editwrap .w-e-progress {1position: fixed;top:0;height:6px;left: 0;z-index: 99999;background: #f00}
	</style>
</head>
<body id="jameson_read">
	<div id="append_parent"></div>
	<div id="ajaxwaitid"></div>
		<div class="cebian uk-text-center" id="cebian">
			<div class="uk-margin-top"><a href="{eval echo jamesonurl('author',$books['book_id'],'book');}" class="uk-button uk-button-border">{lang jameson_read:zuozhezhongxin}</a></div>
			<div class="uk-card uk-margin-top">
	            <div class="uk-card-media-top">
	                <a href="{eval echo jamesonurl('book',$books['book_id']);}"><img src="{if $books['image']}./data/attachment/forum/{$books['image']}{else}{$_G['jameson_read']['morenfengmian']}{/if}" alt=""></a>
	            </div>
	            <div class="uk-card-body uk-padding-small">
	                <h3 class="uk-card-title"><a href="{eval echo jamesonurl('book',$books['book_id']);}">{$books['book_name']}</a></h3>
	                {if $books['desco']}
	                <p class="uk-text-truncate">{$books['desco']}</p>
	                {/if}
	            </div>
            </div>
		</div>
		<div class="right" id="right">
			<form action="./plugin.php" method="post" class="uk-form uk-form-horizontal" onsubmit="jameson.submit()">
				<input type="hidden" name="formhash" value="{FORMHASH}">
				<input type="hidden" name="id" value="jameson_read">
				<input type="hidden" name="contrl" value="author">
				<input type="hidden" name="act" value="postzhangjie">
				<input type="hidden" name="book_id" value="{$books['book_id']}">
				<input type="hidden" name="tid" value="{if $_GET['tid']}{$_GET['tid']}{else}0{/if}">
				<input type="hidden" name="pid" value="{if $_GET['pid']}{$_GET['pid']}{else}0{/if}">
				<input type="text" required id="subject" class="uk-input uk-form-blank uk-form-large uk-text-large xw1" value="{if $columinfo['subject']}{$columinfo['subject']}{/if}" placeholder="{lang jameson_read:zhangjie}{lang jameson_read:biaoti}" name="subject" />
				<div class="uk-grid-collapse uk-child-width-1-2" uk-grid>
					<div {if $authorinfo[$authorinfo['setsj']]} class="uk-grid-collapse uk-child-width-1-2" uk-grid {/if}>
						<div class="uk-form-controls">
							<select class="uk-select uk-input-short uk-form-blank" name="j_id">
								{loop $books['fenjuan'] $j}
									<option value="{$j['j_id']}" {if  $j['j_id']==$_GET['j_id'] || $j['j_id']==$columinfo['j_id']} selected {/if}>{$j['j_title']}</option>
								{/loop}
							</select>
						</div>
					{if $authorinfo[$authorinfo['setsj']]}
					  {if $authorinfo['setsj']=='zgsj'}
					  	<div class="uk-form-controls">
							<label class="uk-form-label uk-label-auto xg1 xs1" uk-tooltip title="{lang jameson_read:xiaoyu}{$authorinfo['zgsj']}{$_G['jameson_read']['trametitle']}">
								{lang jameson_read:shoujia}:
							</label>
					    	<input class="uk-input uk-input-short uk-form-blank" data-zgsj="{$authorinfo['zgsj']}" type="text" name="price" value="{if $columinfo}{$columinfo['price']}{/if}" placeholder="{lang jameson_read:xiaoyu}{$authorinfo['zgsj']}{$_G['jameson_read']['trametitle']}" />
					   	</div>
					  {else}
					 	<div class="uk-form-controls">
							<label class="uk-form-label uk-label-auto xg1 xs1" uk-tooltip title="{lang jameson_read:xiaoyu}{$authorinfo['zgsj']}{$_G['jameson_read']['trametitle']}">
									{lang jameson_read:shoujia}:
								</label>
					     	<select name="price" class="uk-select uk-input-short uk-form-blank">
					       		<option value="0" {if $columinfo['price']<1} selected {/if}>0</option>
					       		<option value="{$authorinfo['qzsj']}" {if $columinfo['pirce']} selected {/if}>{$authorinfo['qzsj']}</option>
					     	</select>
					  	</div>
					  {/if}
					{/if}
				  </div>

					<div>
					<label class="uk-form-label uk-label-auto xs1 xg1" id="youxiaozishu"></label>
					<div class="uk-form-controls">
						<input type="text" name="zishu" id="inputzishu" class="uk-input uk-input-short uk-form-blank" value="{if $columinfo['length']}{$columinfo['length']}{/if}">
					</div>
					</div>
				</div>
				<textarea class="uk-hidden" id="inputmessage" name="message"></textarea>
				<div id="editwrap"></div>
				<button type="submit" class="uk-button uk-button-danger uk-margin-top uk-margin-bottom">{lang jameson_read:fabu}</button>
			</form>
		</div>
{if $message}
	<div class="uk-hidden" id="hasmessage">
		{$message}
	</div>
{/if}
<script type="text/javascript">
	var jameson = {
		countcn:function (txt) {
		    var Words = txt.replace(/\s|\\n|\\r/g,'').replace(/<\/?\w+[^>]*\>/g,'');
		    var tongji = {
		        zhongwen:0,
		        yingwen:0,
		        shuzi:0,
		        res:0
		    };
			var realLength=0;
			var len=Words.length;
			var charCode=-1;
			for(var i=0;i<len;i++){
				charCode=Words.charCodeAt(i);
				if((charCode>=97&&charCode<=122)||(charCode>=65&&charCode<=90)){ 
					tongji.yingwen++;
				}else if(charCode>=48&&charCode<=57){
					tongji.shuzi++;
				}else if(charCode>128){ 
					tongji.zhongwen++;
				}
				tongji.res = tongji.zhongwen+tongji.yingwen+tongji.shuzi;
			} 
			return tongji;
	    },
	    submit:function(){
	    	layer.load(1, {shade: [0.3,'#2b2b2b']});
	    	editor2.customConfig.onchange(editor2.txt.html())

	    },
	    save:function(){
	    	var has = store.get('jamesonreadcaogao');
    		console.log(has)
    		var title = jQuery.trim(jQuery("#subject").val());
    		var message = jQuery.trim(editor2.txt.html());
    		if(!jQuery.trim(editor2.txt.text()) && /^\s*<p>\s*<br>\s*<\/p>\s*$/.test(message)){
    			return;
    		}
    		title = title?title:'{lang jameson_read:meiyoubiaoti}';
	    	if(has){
	    		has.unshift({
	    			title:title,
	    			message:editor2.txt.html()
	    		})
	    		store.set('jamesonreadcaogao',has)
	    	}else{
	    		store.set('jamesonreadcaogao',[{
	    			title:title,
	    			message:editor2.txt.html()
	    		}]);
	    	}
	    	var hasnum = parseInt(jQuery("#caogaoxiang span").text())?parseInt(jQuery("#caogaoxiang span").text()):0;
	    	jQuery("#caogaoxiang span").text(1+hasnum);
	    	layer.msg('OK');
    		console.log(has)
	    },
	    caogaoxiang:function(){
	    	var has = store.get('jamesonreadcaogao');
	    	if(!has || has.length < 1){
	    		layer.msg('{lang jameson_read:meiyoucaogao}')
	    	}else{
	    		var html = '<div class="uk-padding-small uk-margin-top"><ul class="uk-list uk-list-divider" id="caogaolist">';
	    		for (var i = 0,len = has.length; i < len; i++) {
	    			html += '<li><a class="uk-link-text" href="javascript:;" onclick="jameson.usecaogao('+i+')">'+has[i].title+'</a></li>';
	    		}
	    		html += '<li><a href="javascript:;" onclick="jameson.qingkong()" class="uk-button uk-button-danger">{lang jameson_read:qingkong}</a></li></ul></div>'
	    		layer.open({
	    		  type: 1,
	    		  title: false, //加上边框
	    		  area: ['400px', '450px'], //宽高
	    		  content: html
	    		});
	    	}
	    },
	    qingkong:function(){
	    	store.remove('jamesonreadcaogao');
	    	layer.closeAll();
	    	jQuery("#caogaoxiang span").text(0);
	    },
	    usecaogao:function(m){
	    	var has = store.get('jamesonreadcaogao');
	    	if(has){
	    		for (var i = 0,len = has.length; i < len; i++) {
	    			if(m==i){
	    			jQuery("#subject").val(has[i].title);
	    			document.getElementById("inputmessage").value = has[i].message;
	    			editor2.txt.html(has[i].message)
	    			jameson.countcn(editor2.txt.text())
		    		}
	    		}
	    		has.splice(m,1);
	    		store.set('jamesonreadcaogao',has);
	    		jQuery("#caogaoxiang span").text(has.length);
	    		layer.closeAll();
	    	}
	    }
	};
    var E = window.wangEditor
    var editor2 = new E('#editwrap')
	editor2.customConfig.onchange = function (html) {
        document.getElementById("inputmessage").value = html.replace(/&gt;/ig,'>').replace(/&lt;/ig,'<').replace(/<\/?script[^>]*>/ig,'');
        var tongji = jameson.countcn(editor2.txt.text());
        jQuery("#youxiaozishu").html('{lang jameson_read:hanzihezhongwenbiaodian}<em>'+tongji.zhongwen+'</em>,{lang jameson_read:yingwen}<em>'+tongji.yingwen+'</em>,{lang jameson_read:shuzi}<em>'+tongji.shuzi+'</em>.{lang jameson_read:youxiaozishu}');
        jQuery("#inputzishu").val(tongji.res);
    }
    editor2.customConfig.uploadImgServer = './plugin.php?id=jameson_read:ajax';
    editor2.customConfig.uploadImgMaxSize = '{eval echo intval(ini_get("upload_max_filesize"))*1000000;}'
    editor2.customConfig.uploadImgParams = {
	    formhash: '{FORMHASH}',
	    optype:'uploadzj',
	    book_id:'{$books["book_id"]}'
	}
	editor2.customConfig.uploadFileName = 'images[]';
	editor2.customConfig.uploadImgHeaders = {
	    'Accept': 'text/x-json'
	}
	editor2.customConfig.uploadImgHooks = {
	    before: function (xhr, editor, files) {
	    },
	    success: function (xhr, editor, result) {
	    	document.getElementById("inputmessage").value = editor.txt.html();
	    },
	    fail: function (xhr, editor, result) {
	    },
	    error: function (xhr, editor) {
	    },
	    timeout: function (xhr, editor) {
	    }
	}
    jQuery(function(){
        editor2.create();
        <!--{if $message}-->
        	editor2.txt.html(jQuery("#hasmessage").html());
        <!--{/if}-->
    	jQuery("#editwrap").append('<a href="javascript:;" onclick="jameson.save()" id="savecaogao">{lang jameson_read:savecaogao}</a><a href="javascript:;" onclick="jameson.caogaoxiang()" id="caogaoxiang">{lang jameson_read:caogaoxiang}<span></span></a><i class="quanpingbtn" uk-icon="icon:expand"></i><i class="quanpingbtn uk-hidden" uk-icon="icon:shrink"></i>');
    	jQuery(".quanpingbtn").on('click',function(){
    		jQuery("#cebian").toggleClass('uk-hidden');
    		jQuery("#right").toggleClass('quanping');
    		jQuery(this).toggleClass('uk-hidden');
    		jQuery(this).siblings("i").toggleClass('uk-hidden');
    	});
    	jQuery(".w-e-text").on('paste',function(){
    		editor2.txt.html(editor2.txt.html().replace(/\n/g,'<br>').replace(/&lt;/ig,'<').replace(/&gt;/ig,'>'));
    	})
    	var has = store.get('jamesonreadcaogao');
    	if(has && has.length){
    		jQuery("#caogaoxiang span").text(has.length);
    	}
    });
    window.onunload = function(){
    	jameson.save()
    }
</script>
</body>
</html>